import pymysql  # 导入pymysql

# 创建链接对象
conn = pymysql.connect(host='localhost', port=3306,
                       user='root', password='root',
                       database='advanced', charset='utf8')

# 获取游标对象
cursor = conn.cursor()
rows = cursor.execute('select * from student')
print(f'受影响行数：{rows}')
print(cursor.fetchone())

print(cursor.fetchmany(3))

print(cursor.fetchall())

cursor.close()

conn.close()